package nc.ui.medpub.bd.deptdoc;

import nc.ui.bd.deptdoc.DeptDocCTL;
import nc.ui.bd.deptdoc.DeptDocCopyBtnVO;
import nc.ui.bd.deptdoc.DeptDocExportBtnVO;
import nc.ui.trade.button.IBillButton;
import nc.vo.trade.button.ButtonVO;

public class MedDeptDocCTL extends DeptDocCTL {

	private boolean isHrUse=false;
	private ButtonVO[] fatherButtonVO=null;
	public MedDeptDocCTL(boolean isHrUse,ButtonVO[] fatherButtonVO) {
		super(isHrUse, fatherButtonVO);
		this.isHrUse=isHrUse;
		this.fatherButtonVO=fatherButtonVO;
	}
	
	@Override
	public int[] getCardButtonAry() {
		int[] cardButtonAry = null;
		if (isHrUse) {
			if (fatherButtonVO == null || fatherButtonVO.length == 0) {
				cardButtonAry = new int[] { IBillButton.Add, IBillButton.Save,
						IBillButton.Cancel, IBillButton.Edit,
						IBillButton.Delete, IBillButton.Refresh,
						
						IBillButton.Return,
						DeptDocCopyBtnVO.BTN_NO,
						DeptDocExportBtnVO.BTN_NO,
						MedDeptBtnVO.BTN_NO

				};
			} else {

				int[] fixBtnAry = new int[] { IBillButton.Add, IBillButton.Save,
						IBillButton.Cancel, IBillButton.Edit,
						IBillButton.Delete, IBillButton.Refresh,
						IBillButton.Return,
						DeptDocCopyBtnVO.BTN_NO,
						DeptDocExportBtnVO.BTN_NO,
						MedDeptBtnVO.BTN_NO
						//,DeptDocManBtnVO.BTN_NO
						};
				int[] hrBtnAry = new int[fatherButtonVO.length];
				for (int i = 0; i < fatherButtonVO.length; i++) 
					hrBtnAry[i] = fatherButtonVO[i].getBtnNo();
				cardButtonAry = new int[fixBtnAry.length + hrBtnAry.length];	
				System.arraycopy(fixBtnAry, 0, cardButtonAry, 0, fixBtnAry.length);
				System.arraycopy(hrBtnAry, 0, cardButtonAry, fixBtnAry.length, hrBtnAry.length);
			}
		} else {
			cardButtonAry = new int[] { IBillButton.Add, IBillButton.Save,
					IBillButton.Cancel, IBillButton.Edit, IBillButton.Delete,
					IBillButton.Refresh, 
					IBillButton.Return, DeptDocCopyBtnVO.BTN_NO ,
					DeptDocExportBtnVO.BTN_NO,
					MedDeptBtnVO.BTN_NO
					};

		}
		return cardButtonAry;
	}
}
